<%  response.setHeader("Cache-Control","no-cache") ;  
%><%  response.setHeader("Pragma","no-cache") ;  
%><%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" 
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" 
%><%@page import = "com.db4o.servlet.Db4oServlet" 
%><%@page import = "facades.*" 
%><%@page import = "auser.*" 
%><%@page import = "com.db4o.query.*" 
%><% 
	SessionFacade sfacade = new SessionFacade(session); 
	Query qu = sfacade.newQuery(PianoDeiConti.class); 
	qu.descend("codice").constrain(request.getParameter("q")).startsWith(true) ;  
	
   	Utente utente = (Utente)session.getAttribute("userBean");   
	qu.descend("livello").constrain(2).greater() ;  
	qu.descend("codice").orderAscending();  
	
%><c:if test="${param.causale=='economico_costi'}"> 
	<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("5").startsWith(true).or(
			qu.descend("codice").constrain("6").startsWith(true).or( 
			qu.descend("codice").constrain("7").startsWith(true) 
			));  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("01").startsWith(true).or( 	
			qu.descend("codice").constrain("02").startsWith(true).or( 	
			qu.descend("codice").constrain("03").startsWith(true).or( 	
			qu.descend("codice").constrain("06.AU.03").startsWith(true).or( 	
			qu.descend("codice").constrain("25").greater().and( 	
			qu.descend("codice").constrain("36").smaller() 	
			)))));  	
		%>
		</c:if>
		 		  	
	</c:if>			  	
	
	<c:if test="${param.causale=='economico_ricavi'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("29.AU.02").startsWith(true).or( 	
			qu.descend("codice").constrain("29.AU.03").startsWith(true).or( 	
			qu.descend("codice").constrain("29.AU.04").startsWith(true).or( 
			qu.descend("codice").constrain("29.FA.04").startsWith(true).or( 
			qu.descend("codice").constrain("8").startsWith(true).or(
			qu.descend("codice").constrain("9").startsWith(true) 
			)))));  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("01.AU.01").startsWith(true).or( 	
			qu.descend("codice").constrain("00").greater().and( 	
			qu.descend("codice").constrain("25").smaller() 	
			));  	
		%>
		</c:if>
					  	
	</c:if>	
	 
					  
	<c:if test="${param.causale=='patrimoniale_attivita'}"> 
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		 	
			
			qu.descend("codice").constrain("04").greater().and( 	
			qu.descend("codice").constrain("25").smaller() 	
			);  	
		%>
		
		</c:if>
		
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("01").startsWith(true).or( 	
			qu.descend("codice").constrain("02").startsWith(true).or( 
			qu.descend("codice").constrain("03").startsWith(true).or(
			qu.descend("codice").constrain("98.AU.02").startsWith(true) 
			)));
		%> 
		</c:if>
					  	
	</c:if>	
	 
		  
	<c:if test="${param.causale=='patrimoniale_passivita'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("25").greater().and( 	
			qu.descend("codice").constrain("35").smaller() 	
			);  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			 
			qu.descend("codice").constrain("01").startsWith(true).or( 	
			qu.descend("codice").constrain("02").startsWith(true).or( 
			qu.descend("codice").constrain("03").startsWith(true).or(
			qu.descend("codice").constrain("98.AU.02").startsWith(true) 
			)));
		%>
		</c:if>
					  	
	</c:if>	
	
	
	<c:if test="${param.causale=='storno_pdare'}"> 
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("01").greater().and( 	
			qu.descend("codice").constrain("04").smaller() 	
			);  	
		%>
		
		</c:if>
		
		<c:if test="${param.caller=='a0' ||param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("04").greater().and( 	
			qu.descend("codice").constrain("25").smaller() 	
			);      
		%> 
		</c:if>
					  	
	</c:if>	
	
	<c:if test="${param.causale=='storno_pavere'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("06.AU.03").startsWith(true).or( 
			qu.descend("codice").constrain("01").startsWith(true).or( 	
			qu.descend("codice").constrain("02").startsWith(true).or( 
			qu.descend("codice").constrain("03").startsWith(true)  
			)));  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("25").greater().and( 	
			qu.descend("codice").constrain("35").smaller() 	
			); 	
		%>
		</c:if>
					  	
	</c:if>	
	
	
	<c:if test="${param.causale=='giroconto_edare'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("5").startsWith(true).or(
			qu.descend("codice").constrain("6").startsWith(true).or( 
			qu.descend("codice").constrain("7").startsWith(true) 
			));  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("01").startsWith(true).or(
			qu.descend("codice").constrain("02").startsWith(true).or(
			qu.descend("codice").constrain("03").startsWith(true).or(
			qu.descend("codice").constrain("5").startsWith(true).or(
			qu.descend("codice").constrain("6").startsWith(true).or( 
			qu.descend("codice").constrain("7").startsWith(true) 
			)))));  	
		%>
		</c:if>
					  	
	</c:if>	

	<c:if test="${param.causale=='giroconto_eavere'}"> 
		<c:if test="${param.caller=='a0' ||param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("01").startsWith(true).or( 
			qu.descend("codice").constrain("02").startsWith(true).or( 
			qu.descend("codice").constrain("03").startsWith(true).or( 
			qu.descend("codice").constrain("8").startsWith(true).or( 
			qu.descend("codice").constrain("9").startsWith(true) 
			))));  	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' ||param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("8").startsWith(true).or( 
			qu.descend("codice").constrain("9").startsWith(true) 
			);   	
		%>
		</c:if>
					  	
	</c:if>	
	
	<c:if test="${param.causale=='giroconto_pdare'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("01").greater().and( 	
			qu.descend("codice").constrain("25").smaller() 	
			); 	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("01").greater().and( 	
			qu.descend("codice").constrain("25").smaller() 	
			);     	
		%>
		</c:if>
					  	
	</c:if>	
	
	<c:if test="${param.causale=='giroconto_pavere'}"> 
		<c:if test="${param.caller=='a0' || param.caller=='a1' || param.caller=='a2' || param.caller=='a3'}"> 
		<%		
			qu.descend("codice").constrain("25").greater().and( 	
			qu.descend("codice").constrain("34").smaller() 	
			); 	 	
		%>
		</c:if>
		
		<c:if test="${param.caller=='d0' || param.caller=='d1' || param.caller=='d2' || param.caller=='d3'}"> 
		<%		
			qu.descend("codice").constrain("25").greater().and( 	
			qu.descend("codice").constrain("34").smaller() 	
			); 	    	
		%>
		</c:if>
					  	
	</c:if>	
	
<c:forEach items="<%=qu.execute()%>" var="voce" varStatus="status"
><c:if test="${voce.circolo==userBean.circolo || voce.livello<4}"
>${voce.codice}|${voce.descrizione}|${param.caller}|<%=sfacade.getID("voce",pageContext) %>|${voce.codice}
</c:if
></c:forEach>